#include "testobject.h"
#include <iostream>

TestObject::TestObject(Renderer *renderer)
{
	rnd = renderer;
	image = rnd->loadImage("Images//FighterJet128.png");
	if(image != NULL)
		texId = rnd->createTexture(image);
	
	position.x = position.y = 256;
	position.w = position.h = 128;
	
	vel = 0.f;
	angle = 0.f;
	rotation = 0.f;
	
	curClip = NULL;
}
TestObject::~TestObject()
{
	if(image!=NULL)
		SDL_FreeSurface(image);
}
void TestObject::show()
{
	rnd->drawSurface(&position, angle, texId);
}
void TestObject::move(Uint32 dTicks)
{
	if((dTicks > 0))
	{
		float aRadians = -(angle/57.29578);
		position.x += ((dTicks/1000.f)*vel)*sin(aRadians);
		position.y += ((dTicks/1000.f)*vel)*cos(aRadians);
		angle += rotation;
	}
}

